/* 
 * File:   entity.hpp
 * Author: jolo
 *
 * Created on 10. Oktober 2011, 23:56
 */

#ifndef MODEL_ENTITY_HPP
#define	MODEL_ENTITY_HPP

#include <boost/noncopyable.hpp>

#include <boost/uuid/uuid.hpp>
#include <boost/uuid/uuid_generators.hpp>
#include <boost/uuid/uuid_io.hpp>
#include <boost/uuid/uuid_serialize.hpp>

#include <boost/serialization/access.hpp>
#include <boost/serialization/serialization.hpp>
#include <boost/serialization/string.hpp>
#include <boost/serialization/vector.hpp>
#include <boost/serialization/version.hpp>
#include <boost/serialization/smart_cast.hpp>
#include <boost/serialization/shared_ptr.hpp>

#include <core/core.hpp>

namespace model
{

    class entity : public boost::noncopyable
    {
    public:
        entity();
        virtual ~entity();

        virtual const string to_string() const;
        virtual const string to_html_table() const;
        virtual const string to_html_page() const;
        virtual void print_on(std::ostream& s) const;

        const boost::uuids::uuid uuid() const
        {
            return uuid_;
        }

        virtual const string short_label() const;
        virtual string_vector field_sequence() const;
        virtual string_map field_values() const;

        virtual const string object_name() const;

    protected:
        virtual const string to_string(const int i) const;
        virtual const string to_string(const double d) const;
        virtual const string to_string(const boost::uuids::uuid u) const;

    private:
        friend class boost::serialization::access;

        template<class Archive>
        void serialize(Archive & ar, const unsigned int version)
        {
            (void) version;
            ar & uuid_;
        }
        boost::uuids::uuid uuid_;
    };
}

template <typename CharT, typename Traits>
std::basic_ostream<CharT, Traits>& operator<<(
        std::basic_ostream<CharT, Traits>& out, const model::entity& e)
{
    e.print_on(out);
    return out;
}

#endif	/* ENTITY_HPP */

